package chapter01

object Test02_varval {
  def main(args: Array[String]): Unit = {
    //定义一个变量 var修饰的变量可以修改
    var a = 20
    a = 30
    println(a)
    //val定义的变量不可以修改
    val b = 15
    //b = 20
    println(b)
    //交换两个变量的值
    var m = "可乐"
    var n = "雪碧"
    var empty = m
    m = n
    n = empty
    println(m,n)
    //如果数字类型 d = 20 e = 50 不使用第三个变量
    var d: Int = 20
    var e = 50
    d = d+e //20+50
    e = d-e //20+50-50
    d = d-e //20+50-20
    println(d,e)
    val str:String = "abc"
  }
}
